import './assets/main.css'
import { createApp } from 'vue'

import './service/request'
import App from './App.vue'
import router from './router'
import MyHeader from '@/components/my-header/indexView.vue'
// 如果您正在使用CDN引入，请删除下面一行。
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

import Vue3DraggableResizable from 'vue3-draggable-resizable'
//需引入默认样式
import 'vue3-draggable-resizable/dist/Vue3DraggableResizable.css'
// import function to register Swiper custom elements
import { register } from 'swiper/element/bundle'
import { directives } from './directives'
import { store } from './stores'
// vue3
import WujieVue from 'wujie-vue3'

// register Swiper custom elements
register()

const app = createApp(App)
app.use(WujieVue)
// app.config.warnHandler = () => null
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  // 只注册我用到的就可以
  const customComponents = ['DArrowRight']
  if (customComponents.includes(key)) {
    app.component(key, component)
  }
}

app.component('my-header', MyHeader)
// 自定义指令
directives.forEach((v) => {
  app.directive(v.name, v.config)
})

app.use(store)
app.use(router)
app.use(Vue3DraggableResizable)

app.mount('#app')
